package com.wondersgroup.retrofittest.login;

import android.os.Bundle;
import android.support.annotation.Nullable;

import com.hss.mvp.base.BaseActivty;
import com.wondersgroup.retrofittest.R;
import com.wondersgroup.retrofittest.login.presenter.LoginPresenterImpl;

/**
 * <b>Project:</b> RetrofitTest<br>
 * <b>Create Date:</b> 2017/2/7 0007<br>
 * <b>Author:</b> huang saisai <br>
 * <b>Description:</b> <br>
 */
public class LoginActivity extends BaseActivty{

    LoginPresenterImpl loginPresenter;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_base);
        initData();
        initView();
    }

    @Override
    public void initData() {
        loginPresenter=  new LoginPresenterImpl();
    }

    @Override
    public void initView() {
        LoginFragment loginFragment  = null;
        try {
            loginFragment   = addFragment2Frame(LoginFragment.class,R.id.contentFrame);
            loginFragment.setPresenter(loginPresenter);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void destoryRes() {
        super.destoryRes();

        if (loginPresenter != null){
            loginPresenter.destoryRes();
        }
    }


}
